<template>
	<view class="root" @click="toDetail(item)">
		<view class="pic">
			<image :src="item.picurls" mode="aspectFill"></image>
		</view>
		<view class="text">
			<view class="title">
				{{item.title}}
			</view>
			<view class="info" v-if="item.time">
				<text>发布时间：{{item.time}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "passage",
		props: { //接收组件
			item: { //默认对象
				type: Object,
				default () {
					return {}
				}
			}
		},
		data() {
			return {

			};
		},
		onLoad() {

		},
		methods: {
			toDetail(item) {
				console.log('passage的item:', item);
				uni.navigateTo({
					url: `/pages_index/detail/detail?cid=${item.classid}&id=${item.id}`
				})
			}
		}
	}
</script>

<style lang="scss">
	.root {
		display: flex;

		.pic {
			padding: 10rpx;
			width: 250rpx;
			height: 150rpx;

			image {
				width: 100%;
				height: 100%;
			}
		}

		.text {
			// border: 1px solid black;
			flex: 1;
			padding-left: 25rpx;
			display: flex;
			flex-direction: column;
			justify-content: center;

			.title {
				@include ellipsis(2); //css样式省略号2行
				font-size: 40rpx;
				font-weight: bold;
				font-family: "微软雅黑";
				color: #333;
			}

			.info {
				padding: 20rpx 0 0 0;
				font-size: 25rpx;
				color: #666;
				// 两行省略
				@include ellipsis(2);
			}
		}
	}
</style>
